<%@ include file="/WEB-INF/jsp/include/head.jsp" %><%@ page language="java" pageEncoding="UTF-8"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <%@ include file="/WEB-INF/jsp/include/title.jsp" %>
    <%@ include file="/WEB-INF/jsp/include/common_css.jsp" %>
    <link rel="stylesheet" type="text/css" media="screen" href="<c:url value="/css/skin/default/default.css"/>"/>
    <%@ include file="/WEB-INF/jsp/include/common_script.jsp" %>
    <script type="text/javascript" src="<c:url value="/js/editor/editor.js"/>"></script>
    <script type="text/javascript">
    //<![CDATA[
    <%@ include file="/js/bbs/bbs.js" %>

	function fntOut(event) {
		$(this).attr("class", "pw_fnt_out");
	}
	
	function fntOver(event) {
		$(this).attr("class", "pw_fnt_over");
	}

	function printPage(sid) {
		window.open("<c:url value='/issue/print.do?sid=" + sid + "&command=PRINT'/>", '_print');
	}

	function memoInput(sid, depth, command) {
		$("#memoInput").toggle();
		$("#memoSid").val(sid);
		$("#memoDepth").val(depth);
		if(command) $("#command").val(command);
		$("#memoInput").appendTo("#key" + sid);
		SAGAEditor.reload();
	}
	
	function memoRemove(sid) {
		$("#memoSid").val(sid);
		$('#dialog').dialog('open');
	}
	
    $(document).ready(function() {
        $("#dialog").dialog({
            bgiframe: true,
            autoOpen: false,
            height: 160,
            modal: true,
            buttons: {
                '삭제': function() {
                    var bValid = true;
                    //allFields.removeClass('ui-state-error');
    
                    //bValid = bValid && checkLength(name,"username",3,16);
                    //bValid = bValid && checkLength(email,"email",6,80);
                    //bValid = bValid && checkLength(password,"password",5,16);
    
                    //bValid = bValid && checkRegexp(name,/^[a-z]([0-9a-z_])+$/i,"Username may consist of a-z, 0-9, underscores, begin with a letter.");
                    //bValid = bValid && checkRegexp(email,/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i,"eg. ui@jquery.com");
                    //bValid = bValid && checkRegexp(password,/^([0-9a-zA-Z])+$/,"Password field only allow : a-z 0-9");
                    
/*                    if (bValid) {
                        $('#users tbody').append('<tr>' +
                            '<td>' + name.val() + '<\/td>' + 
                            '<td>' + email.val() + '<\/td>' + 
                            '<td>' + password.val() + '<\/td>' +
                            '<\/tr>'); 
                        $(this).dialog('close');
                    }*/

                    $("#userPasswd").val($("#password").val());
                    formSubmit("frmIssue", "REMOVE");
                },
                '취소': function() {
                    $(this).dialog('close');
                }
            },
            close: function() {
//                allFields.val('').removeClass('ui-state-error');
            }
        });
        
        if("${param.command}" == "PRINT")
            window.print();
        
        $("#memoInput").hide();

        $("#memo").click(function () {
            $("#memoInput").toggle();
            $("#memoInput").appendTo("#memoArea");
            $("#command").val("ADD");
            SAGAEditor.reload();
            
            location.href = "#memoInput";
//            $("#frmIssue :input:visible:enabled:first").focus();
        });
        
        $("#addMemo").click(function () {
            $("#memoInput").toggle();
            $("#command").val("ADD");
            location.href = "#memoInput";
        });
        
        $(".pw_fnt_out").bind("mouseover", fntOver).bind("mouseout", fntOut);
    });

    $(window).load(function () {
        $("#content").editor({
            id : "content",
            isLoad : false,
            scriptUrl : "test.js",
            plugins : "empty",
            buttons : "bold,italic"
        });
    });    
    //]]>
    </script>
</head>
<body>
<c:if test="${param.command != 'PRINT'}">
<%@ include file="/WEB-INF/jsp/include/top.jsp" %>
</c:if>
    <form:form id="frmIssue" method="post" action="${ctx}/issue/memo.do" commandName="issue" modelAttribute="issue">
    <form:hidden path="sid" />
    <form:hidden path="projectCode" id="projectCode" />
    <input type="hidden" id="userPasswd" name="userPasswd" />
    <input type="hidden" id="memoSid" name="memoList[0].sid" />
    <input type="hidden" id="memoDepth" name="memoList[0].depth" />
    <input type="hidden" id="command" name="command" />
    <div id="pw_content">
        <jsp:include page="./skin/default/view.jsp" />
    </div>
    </form:form>
<c:if test="${param.command != 'PRINT'}">    
<%@ include file="/WEB-INF/jsp/include/footer.jsp" %>
</c:if>    
</body>
</html>